<?php
class CmsLoginControl extends CmsBaseControl
{
    public function Render()
    {
        $user = RequestHandler::GetPost('user');
        if (is_array($user))
        {
            try
            {
                $this->config->GetUserModel()->Login($user);
                $ref = RequestHandler::Get('ref');
                RequestHandler::Redirect($ref ? $ref : AppConfig::GetInstance()->URL);
            }
            catch (Exception $ex)
            {
                MessageBase::Warning($ex->getMessage());
            }
        }
        return parent::Render();
    }
}
?>
